﻿using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities;

namespace AbpToDomain.EntityInfo
{
    //物料
    public class MaterialBase : Entity
    {
        [Key]
        public Guid Id_Materialbase { get; set; }
        public DateTime CreatedDate { get; set; }
        [Comment("物料号")]
        public string MaterialName { get; set; }
        [Comment("Lpn")]
        public string MaterialCode { get; set; }
        [Comment("批次号")]
        public string? Batch {  get; set; }
        [Comment("物料大小")]
        public string? Size {  get; set; }
        [Comment("1个单位物料数量")]
        public int? Quantity { get; set; }
        [Comment("单位")]
        public string? Unit { get; set; }
        [Comment("类型")]
        public string? Type { get; set; }
        [Comment("说明")]
        public string? Description { get; set; }
        [Comment("是否删除")]
        public bool? IsDelete {  get; set; }
        public string? Info {  get; set; }
        //foreign key     
        public BoxGrid? BoxGrid { get; set; }
        public List<MaterialOrder>? MaterialOrders { get; set; } = new List<MaterialOrder>();

        public List<NeetOutMaterial> NeetOutMaterials { get; set; }=new List<NeetOutMaterial>();
      

        public override object[] GetKeys()
        {
            return new object[] { Id_Materialbase };
        }
        //function
        public MaterialBase AddMaterialBase( int? Quantity, string? Batch,
         string MaterialCode,string MaterialName,BoxGrid boxGrid)
        {
            MaterialBase materialBase = new MaterialBase();
            materialBase.MaterialCode = MaterialCode;
            materialBase.Batch = Batch;
            materialBase.MaterialName = MaterialName;
            materialBase.Quantity = Quantity;  
            materialBase.BoxGrid = BoxGrid;
            materialBase.CreatedDate = DateTime.Now;
            
            return materialBase;
        }

        public MaterialBase() 
        {
           
        }
    }
}
